package com.example.exception.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Slf4j
@Component
public class LocalInterceptor implements HandlerInterceptor {

    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        if (!validRequestIsLegal(request)) {
            throw new Exception("不合法的请求");
        }
        return true;
    }

    private boolean validRequestIsLegal(HttpServletRequest request) {
        return false;
    }
}
